package com.jhoncy.rapid.auth.config.security;

import com.jhoncy.rapid.base.pojo.BaseUser;
import org.springframework.beans.BeanUtils;
import org.springframework.security.core.GrantedAuthority;

import java.util.Collection;

/**
 * @author zhuangqi
 * @date 2017/7/21.
 */
public class AuthUserFactory {

    public static AuthUser create(BaseUser user,Collection<? extends GrantedAuthority> authorities) {
        AuthUser authUser = new AuthUser(authorities);
        BeanUtils.copyProperties(user,authUser);
        return authUser;
    }
}
